/**
 * 
 */
package com.exject.android.socialphonebook.view;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

import com.exject.android.socialphonebook.R;

/**
 * @author Benjamin Nagel <benjamin.nagel@stud.fh-dortmund.de>
 */
public class DisplayContactOverviewActivity extends TabActivity {
    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.display_contact);
        
        final long defaultValue = Long.MIN_VALUE;
        final long contactId = this.getIntent().getExtras().getLong(
                "contactId", defaultValue);
        if (contactId != defaultValue) {
            
            Resources res = getResources();
            TabHost mTabHost = getTabHost();
            
            Intent contactSummaryIntent = new Intent(this,
                    DisplayContactSummaryActivity.class);
            contactSummaryIntent.putExtra("contactId", contactId);
            mTabHost.addTab(mTabHost.newTabSpec("one").setIndicator("a",
                    res.getDrawable(R.drawable.favorite_active)).setContent(
                    contactSummaryIntent));
            
            Intent contactActivitiesIntent = new Intent(this,
                    DisplayContactActivitiesActivity.class);
            contactActivitiesIntent.putExtra("contactId", contactId);
            mTabHost.addTab(mTabHost.newTabSpec("two").setIndicator("b",
                    res.getDrawable(R.drawable.actions_active)).setContent(
                    contactActivitiesIntent));
            
            Intent contactInformationIntent = new Intent(this,
                    DisplayContactInformationActivity.class);
            contactInformationIntent.putExtra("contactId", contactId);
            mTabHost.addTab(mTabHost.newTabSpec("three").setIndicator("c",
                    res.getDrawable(R.drawable.contacts_active)).setContent(
                    contactInformationIntent));
            mTabHost.setCurrentTab(0);
            
        } else {
            // TODO: Error Messsage, no contact selected
        }
        
    }
}
